﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Internal.Master" Inherits="BPM.Web.ViewPage<BPM.Entity.User>" %>

<asp:Content ID="c1" ContentPlaceHolderID="TitleContent" runat="server">
	设置角色
</asp:Content>
<asp:Content ID="c3" ContentPlaceHolderID="ScriptStyleContent" runat="server">
	<script type="text/javascript">
	userId = <%=this.Model.Id %>;
	</script>
</asp:Content>
<asp:Content ID="c2" ContentPlaceHolderID="MainContent" runat="server">
	<%
		var ad = AD.Singleton.Authority;
		if (Model == null)
		{
	%>
	<div style="text-align: center;">
		<p>
			您查看的用户不存在!</p>
		<p>
			<%=Html.ActionLink("返回用户列表", ad.UserList)%></p>
	</div>
	<%
}
		else
		{
	%>
	<table>
		<thead>
			<tr>
				<td>
					姓名
				</td>
				<td>
					分配角色
				</td>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>
					<%=Model.RealName %>
				</td>
				<td>
					<div id="allRoles">
						<%
							foreach (var role in SysRoles.GetAll())
							{
								var has = this.Model.HasRole(role);
								var strChecked = has ? "checked='checked'" : string.Empty;
						%>
						<label>
							<input type="checkbox" value="<%=role.Id %>" <%=strChecked %>/><%=role.Name %></label>
						<%
							}
						%>
					</div>
				</td>
			</tr>
		</tbody>
		<tfoot>
			<tr>
				<td colspan="4">
					<input type="button" value="修改" onclick="submitData();" />
					<input type="button" value="返回" onclick="returnBack();" />
				</td>
			</tr>
		</tfoot>
	</table>
	<%
}
	%>
</asp:Content>
